package com.bbeginner.learn.no3.practice;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.PagerTabStrip;
import androidx.viewpager.widget.ViewPager;

import android.graphics.Color;
import android.os.Bundle;
import android.util.TypedValue;
import android.widget.TextView;

import com.bbeginner.learn.R;
import com.bbeginner.learn.no3.adapter.CalendarPagerAdapter;
import com.bbeginner.learn.util.DateUtil;

public class CalendarActivity extends AppCompatActivity {

    private static final String TAG = "CalendarActivity";
    private ViewPager vp_calendar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calendar);

        PagerTabStrip pts_calendar = (PagerTabStrip) findViewById(R.id.pts_calendar);
        pts_calendar.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17);
        pts_calendar.setTextColor(Color.BLACK);
        vp_calendar = (ViewPager) findViewById(R.id.vp_calendar);
        TextView tv_calendar = (TextView) findViewById(R.id.tv_calendar);
        tv_calendar.setText(DateUtil.getNowYearCN() + " 日历");

        CalendarPagerAdapter adapter = new CalendarPagerAdapter(getSupportFragmentManager());
        vp_calendar.setAdapter(adapter);
        vp_calendar.setCurrentItem(DateUtil.getNowMonth() - 1);
    }
}